<layout name="page" />
<block name="content">
	{:widget('page_header/adv_search',array('name'=>$folder_name))}
	<div id="adv_search" class="hidden">
		<form method="post" name="form_adv_search" id="form_adv_search">
			<div id="adv_search_header" class="row" style="">
				<h1 style="">高级搜索</h1>
				<i class="x1" class=""></i>
				<a class="btn btn-normal" id="submit_adv_search">搜索</a>
				<a class="btn btn-return" id="close_adv_search">关闭</a>
			</div>
			<div class="row" id="adv_search_body" >
				<div class="box col-6">
					<label class=" input-label" for="li_name">文件名：</label>
					<input  class="input" type="text" id="li_name" name="li_name" >
				</div>
				<div class="box col-6">
					<label class=" input-label" for="li_content">内容：</label>
					<input  class="input" type="text" id="li_content" name="li_content" >
				</div>
				<div class="box col-6">
					<label class="input-label" for="eq_user_name">登录人：</label>
					<input  class="input" type="text" id="eq_user_name" name="eq_user_name" >
				</div>
				<div class="box col-6">
					<label class="input-label">登录时间：</label>
					<input type="text" class="input-date" name="be_create_time" readonly="readonly"/>
					<i class="date-mid">-</i>
					<input type="text" class="input-date" name="en_create_time" readonly="readonly"/>
				</div>
			</div>
		</form>
	</div>
	<if condition="$auth->write">
		<div class="operate-panel">
			<if condition="$auth->admin">
				<div class="input-box w16" style="display:flex;margin-right: 4px;">
					<select class="select" id="move_to">
						<option value="">转移到</option>
						{:fill_option($folder_list)}
					</select>
					<i class="icon"></i>
				</div>
				<a class="btn btn-del" id="btn_del">删除</a>
			</if>
			<i class="mid"></i>
			<a class="btn btn-normal" onclick="add()">新建</a>
		</div>
	</if>
	<div class="sub">
		<div class="table">
			<ul>
				<li class="thead">
					<span class="w3"><label class="checkbox">
							<input type="checkbox"class="toggle-select-all" data="id[]" />
							<i class="icon"></i> </label></span>
					<span class="w10">编号</span>
					<span class="w19 x1"> 文件名 </span>
					<span class="w10">登录时间</span>
					<span class="w7">登录人</span>
				</li>
				<if condition="empty($list)">
					<li class="no-data">
						没找到数据
					</li>
				</if>
				<form method="post" action="" id="form_data">
					<foreach name="list" val="vo">
						<li class="tbody">
							<span class="w3"><label class="checkbox">
									<input  type="checkbox" name="id[]" value="{$vo.id}" />
									<i class="icon"></i></label> </span>
							<span class="w10">{$vo.doc_no}</span>
							<span class="w19 x1"> <a href="{:url('read','id='.$vo['id'])}">{$vo.name} </a> </span>
							<span class="w10">{:to_date($vo['create_time'],'Y-m-d')}</span>
							<span class="w7">{$vo.user_name}</span>
						</li>
					</foreach>
				</form>
			</ul>
		</div>
		<if condition="!empty($list)">
			{$page}
		</if>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;

			set_return_url(null);
			$("#move_to").on('change', function() {
				if (this.value !== '') {
					move_to(this.value);
				}
			});

			$("#btn_del").on('click', function() {
				if ($("input[name='id[]']:checked").length == 0) {
					layer.msg('请选择要删除的项目');
					return false;
				}
				//信息框-例2
				layer.msg('确定要删除吗?', {
					time : 0,
					btn : ['确定', '取消'],
					yes : function(index) {
						var vars = $("#form_data").serialize();
						send_ajax("{:url('del')}", vars, function(ret) {
							if (ret.status) {
								layer.msg(ret.info, function() {
									location.reload(true);
								});
							}
						});
					},
					no : function(index) {
						layer.close(index);
					}
				});
			});

			$("#btn_add").on('click', function() {
				window.open("{:url('add','fid='.$folder)}", "_self");
			});

			function move_to(val) {
				var vars = $("#form_data").serialize();
				send_ajax("{:url('move_to')}", "val=" + val + "&" + vars, function(ret) {
					if (ret.status) {
						layer.msg(ret.info, function() {
							location.reload(true);
						});
					}
				});
			};
		});
	</script>
</block>